package xmlS
{
	import main.XMLLoaderBase;
	
	public class ReadyXMLLoader extends XMLLoaderBase
	{
		private var _callBack:Function;
		private var _itemList:Array = [];
		public function ReadyXMLLoader()
		{
			super();
		}
		
		public function init(callBack:Function = null):void
		{
			_callBack = callBack;
			super.loadXml(uri.getEatingResturantXmlUri("packageTip"),loadXMLComplete);
		}
		
		private function loadXMLComplete(value:XML):void
		{
			var xmlList:XMLList = value.child("group");
			for(var i:int=0;i<xmlList.length();i++)
			{
				var item:Object = {};
				item.name = String(xmlList[i].@name);
				item.content = addSpace(String(xmlList[i]).split(","));
				_itemList.push(item);
			}
			
			if(_callBack != null)
			{
				_callBack();
			}
		}
		
		private function addSpace(list:Array):String
		{
			return list.join("          ");
		}
		
		public function get itemList():Array
		{
			return _itemList;
		}
		
	}
}